#!/bin/bash

# 定义基础参数
BASE_URL="http://172.16.104.108:9090/xxl-job-admin"
COOKIE_FILE="cookies.txt"

# 定义请求数据
POST_DATA="
  jobGroup=9
  &jobDesc=流媒体网络质量检测 60秒执行一次
  &author=abt
  &alarmEmail=
  &scheduleType=CRON
  &scheduleConf=0 * * * * ?
  &cronGen_display=0 * * * * ?
  &schedule_conf_CRON=
  &schedule_conf_FIX_RATE=
  &schedule_conf_FIX_DELAY=
  &glueType=BEAN
  &executorHandler=mediaLinkDetectJobHandler
  &executorParam=
  &executorRouteStrategy=ROUND
  &childJobId=
  &misfireStrategy=DO_NOTHING
  &executorBlockStrategy=SERIAL_EXECUTION
  &executorTimeout=0
  &executorFailRetryCount=0
  &glueRemark=GLUE代码初始化
  &glueSource=
"

# 发送POST请求
curl -X POST "${BASE_URL}/jobinfo/add" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -b "${COOKIE_FILE}" \
  -d "$(echo ${POST_DATA} | tr -d '\n' | tr -s ' ')"
  
#curl -X POST http://172.16.104.108:9090/xxl-job-admin/jobinfo/add -H "Content-Type: application/x-www-form-urlencoded" -b cookies.txt -d "jobGroup=9&jobDesc=test使用&author=abt&alarmEmail=&scheduleType=CRON&scheduleConf=0 * * * * ?&cronGen_display=0 * * * * ?&schedule_conf_CRON=&schedule_conf_FIX_RATE=&schedule_conf_FIX_DELAY=&glueType=BEAN&executorHandler=testJobHandler&executorParam=&executorRouteStrategy=ROUND&childJobId=&misfireStrategy=DO_NOTHING&executorBlockStrategy=SERIAL_EXECUTION&executorTimeout=0&executorFailRetryCount=0&glueRemark=GLUE代码初始化&glueSource="